package cn.gameback.supervisionservices.mapper;

import cn.gameback.supervisionservices.entity.UserRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserRoleMapper extends BaseMapper<UserRole> {
    // 通过userId 获取角色
    @Select("SELECT * FROM user_role WHERE userId = #{userId}")
    List<UserRole> getUserRolesByUserId(@Param("userId") Integer userId);

    // 通过roleId 获取用户
    @Select("SELECT * FROM user_role WHERE roleId = #{roleId}")
    List<UserRole> getUserRolesByRoleId(@Param("roleId") Integer roleId);
}

